<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<title>2-iframe-pass cross domain</title>
</head>

<body>
	<div>通过获取传递来的tokne并存储</div>
	<div id="app"></div>
	<script type="text/javascript" src="../jquery-3.7.1.min.js"></script>
	<script>
		$(document).ready(function () {
			getParams();
			function getParams() {
				var url = location.search; //获取url中"?“符后的字串
				if (url.indexOf("?") != -1) {
					var str = url.substr(1);
					strs = str.split("&");
					token = decodeURIComponent(strs[0].replace("token=", ""));//获取url中的id
					document.getElementById('app').innerHTML = "token is : " + token;
					console.log("token is : " + token);
					document.cookie="token=" + token;
				}
			}
		});
	</script>
</body>

</html>